@use "sass:math";

.dialog-popup-overlay, .tooltip-popup-overlay {
	pointer-events: all;
	position: absolute;
	width: 100%;
	height: 100%;
	z-index: $z-index-overlay;
	overflow: hidden;
	top: 0;

	.modal-popup {
		background: var(--material-background);
		border: var(--material-panedivider);
		border-radius: 5px;
		box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 5px 10px rgba(0, 0, 0, 0.6);
	}
}

.dialog-popup-overlay {
	justify-content: center;
	align-items: center;
	display: flex;

	.modal-popup {
		min-width: 200px;
	}
}

.label-popup {
	position: absolute;
	@include popover-pointer($width: 16px, $height: 8px);
	left: -1000px;
	background: var(--material-background);
	border: var(--material-panedivider);
	border-radius: 5px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 5px 10px rgba(0, 0, 0, 0.6);

	.row.label {
		display: flex;

		.column {
			display: flex;
			align-items: center;

			&.first {
				input {
					width: 100px;
				}
			}

			&.second {
				margin-inline-start: 10px;
				user-select: none;

				label {
					padding-inline-start: 5px;
				}
			}
		}
	}
}

// Modal popup elements
.modal-popup {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 16px;

	.row {
		&.checkbox {
			display: flex;

			input {
				margin-inline-end: 10px;
			}
		}

		&.buttons {
			display: flex;
			justify-content: flex-end;
			gap: 8px;
		}

		&.radio {
			user-select: none;
			border: 0;
			margin-top: 8px;

			legend {
				font-size: rem(11); // Replaced $toolbar-field-font-size
				font-weight: bold;
				padding-bottom: 4px;
			}

			.choice {
				&:not(:last-child) {
					padding-bottom: 5px;
				}

				display: flex;
				align-items: center;

				input:focus-visible {
					box-shadow: 0 0 0 2px rgba(#0a6cf5, 0.5), 0 0 0 1px #a5afc1; // Replaced rgba($accent-color, 0.5), $search-box-shadow
				}

				input:-moz-focusring {
					box-shadow: 0 0 0 2px rgba(#0a6cf5, 0.5), 0 0 0 1px #a5afc1; // Replaced rgba($accent-color, 0.5), $search-box-shadow
				}

				label {
					padding-left: 5px;
				}
			}
		}
	}

	progress {
		width: 100%;
	}

	input[type=radio]:disabled + label {
		color: var(--fill-secondary);
	}

	input[type=text] {
		padding: 0 7px;
		background: var(--material-background);
		border-radius: 5px;
		border: var(--material-border-quinary);
		height: 22px;

		&:disabled {
			color: var(--fill-tertiary);
		}
	}

	button {
		height: 22px;
		padding: 0 7px;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		border-radius: 5px;
		background: var(--material-button);
		box-shadow: 0px 0px 0px 0.5px rgba(0, 0, 0, 0.05), 0px 0.5px 2.5px 0px rgba(0, 0, 0, 0.30);

		&.primary {
			background: linear-gradient(180deg, rgba(255, 255, 255, 0.17) 0%, rgba(255, 255, 255, 0.00) 100%), var(--accent-blue);
			color: var(--accent-white);
		}

		&:-moz-focusring {
			box-shadow: 0 0 0 4px rgba(#0a6cf5, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.15), 0 1px 0 1px rgba(0, 0, 0, 0.03), 0 1px 0 rgba(0, 0, 0, 0.12); // Replaced $overlay-btn-focus-box-shadow
		}

		&:focus-visible {
			box-shadow: 0 0 0 4px rgba(#0a6cf5, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.15), 0 1px 0 1px rgba(0, 0, 0, 0.03), 0 1px 0 rgba(0, 0, 0, 0.12); // Replaced $overlay-btn-focus-box-shadow
		}

		&:active:not(:disabled), &.active:not(:disabled) {
			background: linear-gradient(to bottom, rgba(255, 255, 255, 0.25), rgba(0, 0, 0, 0.05)), darken(#0a6cf5, 6%); // Replaced $gradient-btn-active-bg
		}

		&:disabled {
			opacity: 0.7;
		}

		@media (-moz-platform: macos) {
			&:-moz-window-inactive {
				background: var(--material-button);
				box-shadow: 0px 0px 0px 0.5px rgba(0, 0, 0, 0.05), 0px 0.5px 2.5px 0px rgba(0, 0, 0, 0.30);
			}
		}
	}
}
